<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!-- 全局js -->
<script src="${pageContext.request.contextPath}/static/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/layer/layer.min.js"></script>
<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/static/js/content.js?v=1.0.0"></script>
<!-- Bootstrap table -->
<script src="${pageContext.request.contextPath}/static/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/treeview/bootstrap-treeview.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<!-- jQuery Validation plugin javascript-->
<script src="${pageContext.request.contextPath}/static/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/validate/messages_zh.min.js"></script>
<!-- iCheck -->
<script src="${pageContext.request.contextPath}/static/js/plugins/iCheck/icheck.min.js"></script>
<!-- Data picker -->
<script src="${pageContext.request.contextPath}/static/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<!-- layerDate plugin javascript -->
<script src="${pageContext.request.contextPath}/static/js/plugins/layer/laydate/laydate.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/fileupload/plugins/sortable.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/fileupload/fileinput.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/fileupload/locales/zh.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/fileupload/locales/es.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/css/plugins/fileupload/themes/explorer-fa/theme.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/css/plugins/fileupload/themes/fa/theme.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/base.js"
        type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/layer/extend/layer.ext.js"
        type="text/javascript"></script>

<script>
    layer.config({
        extend: 'extend/layer.ext.js'
    });
    // 打开新页面
    // 打开自定义新选项卡：<a href="#" onclick="openTabPage('url', '自定义标题')">test</a>
    // 打开系统选项卡：<a href="#" onclick="openTabPage('url')">查看提现记录</a>
    function openTabPage(url, title) {
        var wpd = $(window.parent.document);
        var mainContent = wpd.find('.J_mainContent');
        var thisIframe = mainContent.find("iframe[data-id='"+ url +"']");
        var pageTabs = wpd.find('.J_menuTabs .page-tabs-content ')
        pageTabs.find(".J_menuTab.active").removeClass("active");
        mainContent.find("iframe").css("display", "none");
        if(thisIframe.length > 0){	// 选项卡已打开
            thisIframe.css("display", "inline");
            pageTabs.find(".J_menuTab[data-id='"+ url +"']").addClass("active");
        }else{
            var menuItem = wpd.find("a.J_menuItem[href='"+ url +"']");
            var dataIndex = title == undefined ? menuItem.attr("data-index") : '9999';
            var _title = title == undefined ? menuItem.find('.nav-label').text() : title;
            var iframe = '<iframe class="J_iframe" name="iframe'+ dataIndex +'" width="100%" height="100%" src="' + url + '" frameborder="0" data-id="' + url
                + '" seamless="" style="display: inline;"></iframe>';
            pageTabs.append(
                ' <a href="javascript:;" class="J_menuTab active" data-id="'+url+'">' + _title + ' <i class="fa fa-times-circle"></i></a>');
            mainContent.append(iframe);
            //显示loading提示
            var loading = top.layer.load();
            mainContent.find('iframe:visible').load(function () {
                //iframe加载完成后隐藏loading提示
                top.layer.close(loading);
            });
        }

    }

</script>